local benxi = fk.CreateSkill {

  name = "ym_water__benxi",

}

Fk:loadTranslationTable{
  ["ym_water__benxi"] = "奔袭",
  [":ym_water__benxi"] = "你使用牌后，可调离一个邻座。你对你使用牌的唯一合法目标使用的牌多结算一次。",
  ["#ym_water__benxi-ask"] = "奔袭:请选择一个邻座调离",
}
local DIY = require "packages/diy_utility/diy_utility"

benxi:addEffect(fk.CardUseFinished, {
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(benxi.name) and target==player
  end,
  on_cost = function(self, event, target, player, data)
    local room = player.room
    local players = {}
    table.insertIfNeed(players,player:getLastAlive())
    table.insertIfNeed(players,player:getNextAlive())
    if #players==0 then return end
    local tos = room:askToChoosePlayers(player, {
        targets = players,
        min_num = 1,
        max_num = 1,
        prompt = "#ym_water__benxi-ask",
        skill_name = benxi.name,
        cancelable = true,
      })
    if #tos > 0 then
      event:setCostData(self, tos[1])
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to=event:getCostData(self)
    DIY.removePlayer(to, "-turn")
  end,
})


benxi:addEffect(fk.CardUsing, {
    anim_type = "offensive",
    can_trigger = function (self, event, target, player, data)
      if target == player and player:hasSkill(benxi.name)  then
        return  data:isOnlyTarget(data.tos[1])
      end
    end,
    on_cost = function (self, event, target, player, data)
        return true
    end,
    on_use = function (self, event, target, player, data)
      local room = player.room
        data.additionalEffect = (data.additionalEffect or 0) + 1
    end,
  }) 

return benxi